package org.vectrics.location.web.struts;

import org.apache.ecs.html.A;
import org.apache.ecs.html.IMG;
import org.vectrics.common.view.HtmlForm;
import org.vectrics.common.view.HtmlFormEditRow;
import org.vectrics.struts.VectricsTagSupport;

public class LocationSearchFormTag extends VectricsTagSupport {

	private static final long serialVersionUID = -3148530522118894048L;
	
	private String locationId = null;
	
	@Override
	protected String makeStartTag() {
		HtmlForm form = new HtmlForm(this.getRequest(), "locationSearchForm", this.getPhrase("phrase.location.search.information"));
		
		form.setAction("/admin/location/locationSearch");
		HtmlFormEditRow formRow = (HtmlFormEditRow)form.addEditForParam(this.getPhrase("prompt.location.name"), "locationName", false);
		//Input locationNameEdit = formRow.getEditBox();  
		//locationNameEdit.setOnChange("findMatches();");
		
		StringBuffer html = new StringBuffer();
		html.append(form.toString());

		A pickLink = new A();
    	pickLink.setHref("");
    	pickLink.setOnClick("findMatches(); return false");
    	IMG buttonImage = new IMG();
    	buttonImage.setSrc("/hrs-intranet/dynagraphic/button.jpg?code=button.param&caption=" +
    			this.getPhrase("phrase.search"));
    	buttonImage.setAlt("Search");
    	buttonImage.setBorder(0);
    	pickLink.addElement(buttonImage);
    	html.append(pickLink.toString());
		
		return(html.toString());
	}

	public String getLocationId() {
		return locationId;
	}

	public void setLocationId(String locationId) {
		this.locationId = locationId;
	}
	
}
